From 1b705ff3fca33bf221da0e2b991dfc4b017bb05c Mon Sep 17 00:00:00 2001 From: Joseph Marrero Corchado Date: Mon, 29 Jun 2026 15:22:19 -0400 Subject: [PATCH] tests: Fix "remote:branch" test to use ostree_parse_refspec MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ostree_validate_rev() validates bare ref names and does not accept the "remote:ref" refspec syntax — the colon is not part of the OSTREE_REF_REGEXP regex. The "remote:branch" form is a refspec, which is parsed by ostree_parse_refspec(). Replace the incorrect ostree_validate_rev() call with ostree_parse_refspec() and verify the parsed remote and ref components, preserving the original test intent. Fixes: ac10a27d ("pull: Fix GLib assertion crash on invalid UTF-8 ref names") --- tests/test-validate-utf8.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test-validate-utf8.c b/tests/test-validate-utf8.c index 4aa07cfc..9f84e6bf 100644 --- a/tests/test-validate-utf8.c +++ b/tests/test-validate-utf8.c @@ -42,9 +42,17 @@ test_valid_utf8_refs (void) g_assert_true (ostree_validate_rev ("my.branch_name", &error)); g_assert_no_error (error); - /* Valid ref with remote */ - g_assert_true (ostree_validate_rev ("remote:branch", &error)); - g_assert_no_error (error); + /* Valid refspec with remote: "remote:branch" is a refspec, not a bare ref. + * ostree_validate_rev() only validates bare ref names; use + * ostree_parse_refspec() for the "remote:ref" form. */ + { + g_autofree char *remote = NULL; + g_autofree char *ref = NULL; + g_assert_true (ostree_parse_refspec ("remote:branch", &remote, &ref, &error)); + g_assert_no_error (error); + g_assert_cmpstr (remote, ==, "remote"); + g_assert_cmpstr (ref, ==, "branch"); + } /* Valid ref with slashes */ g_assert_true (ostree_validate_rev ("path/to/branch", &error)); -- 2.39.5